char *strupper(char *src);
char *strlower(char *src);
signed int get_tz_offset(void);
+time_t mklocaltime(struct tm *t);
time_t mkgmtime(struct tm *t);
time_t current_time(void);
signed int month_lookup(const char *m);
* A constant for unknown altitude. It's tempting to just use zero
* but that's not very nice for the folks near sea level.
*/
-#define unknown_alt -99999999.0
-
+#define unknown_alt -99999999.0
+#define unknown_course -999.0
+#define unknown_speed -999.0
/*
* textfile: buffered OS independent (CRLF,NL,CR) text reader
*/
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
+#include <time.h>
static int i_am_little_endian = -1;
static int doswap(void);
return(result);
}
+/*
+ * mklocaltime: same as mktime, but try to recover the "Summer time flag",
+ * which is evaluated by mktime
+ */
+time_t
+mklocaltime(struct tm *t)
+{
+ time_t result;
+ struct tm check = *t;
+
+ check.tm_isdst = 0;
+ result = mktime(&check);
+ check = *localtime(&result);
+ if (check.tm_isdst == 1) { /* DST is in effect */
+ check = *t;
+ check.tm_isdst = 1;
+ result = mktime(&check);
+ }
+ return result;
+}
/*
* A wrapper for time(2) that allows us to "freeze" time for testing.